package com.cloud.punish.workflow.command;

import org.springframework.context.ApplicationContext;

import com.cloud.punish.workflow.handler.Handler;
import com.cloud.punish.workflow.handler.HandlerChain;

/**
 * 操作菜单抽象接口
 * 
 * @author minglong.tao
 *
 */
public abstract class Command implements Handler {

	/**
	 * 指令执行器顶层接口
	 * 
	 * @param request
	 *            请求参数
	 * @param resp
	 *            响应参数
	 */
	public abstract void execute(WfRequest request, WfResponse resp, ApplicationContext context);

	// 指令专注于处理业务逻辑
	public void handler(WfRequest request, WfResponse resp, HandlerChain chain) {
		this.execute(request, resp, chain.getApplicationContext());
		chain.doHandler(request, resp);
	}

}
